<h2>商品管理</h2>
<?php
$this->menu = array(
	array('label'=>'添加商品', 'url'=>array('edit'), 'visible'=>Yii::app()->user->v('manage@GoodsEdit')),
);
?>
<div id="tools">
	<a href="javascript:void(0)" class="icon select_all">全选</a>
	<a href="javascript:void(0)" class="icon select_revert">反选</a>
	<a href="javascript:void(0)" class="icon delete_all">批量删除</a>
	<a href="javascript:void(0)" class="icon sale_all">批量上架</a>
	<a href="javascript:void(0)" class="icon off_sale_all">批量下架</a>
	<a href="javascript:void(0)" class="icon export_all">批量导出</a>
	
</div>
<?php 
$table = new YDataGrid($list, array(
	'columns' => array(
		'name',
		'cate',
		'price',
		'stock',
		'goods_flag'
	),
	'key' => '_id'
));

$table
->setTitles(array('商品名称', '商品分类', '价格', '库存', '标识'))
->setColumnValues(array(
	'A' => 'php:"<label><input type=\"checkbox\" name=\"goods_ids[]\" value=\"{$key}\"> {$data}</label>"',
	'B' => 'php:GoodsCateModel::getCateFamilys($data, " > ", "<br>", "", "goods")',
	'C' => 'php:number_format($data, 2)',
	'D' => 'php:$data<0?"--":$data',
	'E' => new YDataGridFlagsCell('goods_flag'),
))
->insertCol(0, array(
	YHtmlDataGrid::link('编辑', '/manage/Goods/Edit/{$key}', array('visible'=>Yii::app()->user->v('manage@GoodsEdit'))),
	YHtmlDataGrid::link('预览', '/Goods/{$key}.html', array('target'=>'_blank'))
), '操作')
->addColClass(array(
	'A' => 'alt',
	'C' => 'right',
	'D' => 'right',
	'F' => 'title center'
))
->render(false);